import sys
from PyQt5.Qt import *
from tts import TTS
app = QApplication(sys.argv)

class LineEdit:
    def __init__(self):
        self.window = QWidget()
        self.line = QLineEdit("请输入你想说的内容",self.window)
        self.window.resize(1024,1024)
        self.line.resize(300,300)
        self.subbtn = QPushButton("提交",self.window)
        self.subbtn.resize(300,100)
        self.line.move(362,362)
        self.subbtn.move(362,712)
        self.log = []
        self.ai = TTS.AiTTs()

    def initAi(self):
        self.ai.LoadModel()
    def LogWord(self):
        if self.line.isModified():
            self.log.append(self.line.text())
            self.line.setModified(False)
            add = self.line.text()
            self.log.append(add)
            print(add)
            self.connectTTS(add)

    def connectTTS(self,word):
        self.ai.RunTTs(word)

    def RunWork(self):
        self.subbtn.clicked.connect(self.LogWord)
        self.window.show()


line = LineEdit()
line.RunWork()
sys.exit(app.exec_())
